package com.wyvoid.forum.dao.hibernate;

import com.wyvoid.core.persistent.hibernate.HibernateDAO;
import com.wyvoid.forum.domain.Poll;
import com.wyvoid.forum.dao.IPollDAO;

/**
 * 投票信息Hibernate数据处理实现
 *
 * @author wyvoid
 * @version $Revision: 1.2 $ $Date: 2006/07/26 17:33:42 $
 * @link www.wyvoid.com
 */
public class PollDAO extends HibernateDAO<Poll> implements IPollDAO {

    /**
     * 根据主题编号查找投票信息
     *
     * @param topicId 主题编号
     * @return Poll 投票信息
     */
    public Poll findPoll(int topicId) {
        return doQueryUnique("from Poll as p left outer join fetch p.pollResults where p.topicId=?", topicId);
    }
}
